<extend name="Base/common"/>
<block name="body">
<script>
function changeImg(){
   document.getElementById("img1").src = "{:U('User/verify','','')}/id/"+new Date();
}
</script>
</script>
<!--<div class="bank-indextop">
	提现
</div>-->
<div class="container">
<div class="nav">
    <img src="__IMG__/img_1.png" alt="" id="show">          
    <h3>余额提现</h3>
</div>
<div class="bank-bindbox">
<div class="bank-bindtop">
	<img src="__IMG__/icon11.png" class="bank-binding" /> &nbsp;提现
</div>
<ul class="bank-indexul">
	<li>
		<div class="bank-indexleft">姓名</div>
		<div class="bank-indexright" style="color: #cc2a1e;">{$list.bank_realname}</div>
	</li>
	<li>
		<div class="bank-indexleft">银行账户</div>
		<input type="hidden" id="bank_id" name="bank_id" value="{$list.id}" />
		<div class="bank-indexright" style="color: #cc2a1e;">{$list.bank_name}({$list.bank_card})</div>
	</li>
	<li>
		<div class="bank-indexleft">账户余额</div>
		<div class="bank-indexright"><span id="balance_money">{$money}</span>元</div>
	</li>
	<!--<li>
		<div class="bank-indexleft">赠金</div>
		<div class="bank-indexright">0元</div>
	</li>
	<li>
		<div class="bank-indexleft">可提金额</div>
		<div class="bank-indexright">0元</div>
	</li>-->
	<li>
		<div class="bank-indexleft">提现金额</div>
		<div class="bank-indexright"><input type="text" name="drawing_money" id="drawing_money" value="" placeholder="每笔出金最小100，最大5000" class="bank-indexinput"/></div>
	</li>
	<li>
		<div class="bank-indexleft">交易密码</div>
		<div class="bank-indexright"><input type="password" name="password" id="password" value="" class="bank-indexinput" placeholder="请输入交易密码"/></div>
	</li>
	<!-- <li>
		<div class="bank-indexleft">验证码</div>
		
		<div class="bank-indexright"><input type="text" id="code" name="code" value="" class="bank-indexyanz"/>
		<img class="bank-indexyani" id="img1" onclick="changeImg()"  alt="验证码" src="{:U('User/verify')}" title="点击刷新" /></div>
	</li> -->
	
	<!--<a class="bank-indexok" href="#">确认</a>
	<a class="bank-indexno" id="unbinding">解绑</a>-->
</ul>
<div style = "color:red;margin-top:10px;margin-bottom:20px;">( 注：手续费按提现金额的1%收取，单笔手续费最少2元)</div>
<p class="bank-bindtips clearfix">
		<a class="bank-bindok bank-bindti"  href="javascript:subform()">确认</a>
		<a class="bank-bindno bank-bindti" id="unbinding">解绑</a>
</p>
</div>
<div class="bank-indexUnbundling"></div>
<div class="bank-indexUnbundling2">
	<p class="bank-indexUn">确认解绑</p>
	<p class="bank-indexUn" style="color: #7e7d7d;font-weight: normal;font-size: 12px;">解绑定需要管理员确认，请在微信界面与客服联系。</p>
	<p class="bank-indexUn2">
		<a id="unbindingtwo" style="color: #ce3427;">取消</a>
		<!-- <a>确定</a> -->
	</p>
</div>
</div>
<script type="text/javascript">
$('#unbinding').click(function(){
	$('.bank-indexUnbundling').toggle();
	$('.bank-indexUnbundling2').toggle();
})
$('.bank-indexUnbundling').click(function(){
	$('.bank-indexUnbundling').toggle();
	$('.bank-indexUnbundling2').toggle();
})
$('#unbindingtwo').click(function(){
	$('.bank-indexUnbundling').toggle();
	$('.bank-indexUnbundling2').toggle();
})
function subform(){
	var bank_id=$('#bank_id').val();		//银行账户
	var balance_money=$('#balance_money').html();		//账户余额
	var drawing_money=$('#drawing_money').val();		//提现金额
	var password=$('#password').val();		//交易密码
	var code=$('#code').val();				//验证码
	var reg=/^\d+(\.\d+)?$/g;
   if(drawing_money.trim()=='' || 1*drawing_money<100 || 1*drawing_money>5000 || !reg.test(drawing_money)){
      alert('提现金额不正确');
      return false;
   }
   if(password==""){
       alert('请输入正确的提款密码');
       return false;
   }
   $.post("{:U('User/draw_money')}",
   		{
   			bank_id:bank_id,
   			balance_money:balance_money,
   			drawing_money:drawing_money,
   			password:password,code:code
   		},function(data){
   			alert(data.msg);
   			if(data.status){
   				setTimeout(link_url,1000);
   			}	
  },"json")
}
function link_url(){
	var url_href="{:U('Payments/payments')}";
	window.location.href=url_href;
}
</script>
</block>